package com.cr.admin.business.application.service.impl;

import cn.dev33.satoken.stp.StpUtil;
import com.cr.admin.business.application.dao.repository.ApplicationRepository;
import com.cr.admin.business.application.pojo.entity.Application;
import com.cr.admin.business.application.pojo.param.ApplicationFollowParam;
import com.cr.admin.business.application.pojo.query.ApplicationQuery;
import com.cr.admin.business.application.service.ApplicationService;
import com.cr.admin.system.pojo.entity.SysUser;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ApplicationServiceImpl implements ApplicationService {
    @Autowired
    private ApplicationRepository applicationRepository;

    @Override
    public List<Application> list(ApplicationQuery applicationQuery) {
        return applicationRepository.selectApplication(applicationQuery);
    }

    @Override
    public void followById(ApplicationFollowParam applicationFollowParam) {
        Application application = new Application();
        BeanUtils.copyProperties(applicationFollowParam,application);
        application.setStatus(0);
        applicationRepository.followById(application);
    }

    @Override
    public Application selectById(Long id) {
        return applicationRepository.selectById(id);
    }

    @Override
    public void deleteByIds(List<Long> ids) {
        applicationRepository.deleteByIds(ids);
    }
}
